/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.src.uniandes.ecos.tsp.creditscore.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 *
 * @author AndhyMao
 */
@Entity
@Table(name = "tbl_departamento")
@NamedQueries({@NamedQuery(name = "Departamento.findAll", query = "SELECT d FROM Departamento d"), @NamedQuery(name = "Departamento.findByDepCodigo", query = "SELECT d FROM Departamento d WHERE d.depCodigo = :depCodigo"), @NamedQuery(name = "Departamento.findByDepNombre", query = "SELECT d FROM Departamento d WHERE d.depNombre = :depNombre")})
public class Departamento implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @Column(name = "dep_codigo")
    private Integer depCodigo;
    @Basic(optional = false)
    @Column(name = "dep_nombre")
    private String depNombre;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "departamento")
    private List<Municipio> municipioList;

    public Departamento() {
    }

    public Departamento(Integer depCodigo) {
        this.depCodigo = depCodigo;
    }

    public Departamento(Integer depCodigo, String depNombre) {
        this.depCodigo = depCodigo;
        this.depNombre = depNombre;
    }

    public Integer getDepCodigo() {
        return depCodigo;
    }

    public void setDepCodigo(Integer depCodigo) {
        this.depCodigo = depCodigo;
    }

    public String getDepNombre() {
        return depNombre;
    }

    public void setDepNombre(String depNombre) {
        this.depNombre = depNombre;
    }

    public List<Municipio> getMunicipioList() {
        return municipioList;
    }

    public void setMunicipioList(List<Municipio> municipioList) {
        this.municipioList = municipioList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (depCodigo != null ? depCodigo.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Departamento)) {
            return false;
        }
        Departamento other = (Departamento) object;
        if ((this.depCodigo == null && other.depCodigo != null) || (this.depCodigo != null && !this.depCodigo.equals(other.depCodigo))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.src.uniandes.ecos.tsp.creditscore.entity.Departamento[depCodigo=" + depCodigo + "]";
    }

}
